export function getRandom (sums, mulit) {
  var Ran = []
  var sum
  while (Ran.length < sums) {
    sum = Math.floor(Math.random() * mulit)
    if (Ran.indexOf(sum) === -1) {
      Ran.push(sum)
    }
  }
  return Ran
  // console.log(Ran)
}

export function shuffle (arr) {
  var ret = []
  var lists = getRandom(this.arr.length, this.arr.length)
  for (var i = 0; i < lists.length; i++) {
    ret.push(this.arr[lists[i]])
  }
  return ret
}

export function shuffle1 (arr) {
  var list = []
  var lists = getRandom(arr.length, arr.length)
  // console.log(lists)
  for (var i = 0; i < arr.length; i++) {
    list.push(arr[lists[i]])
  }
  return list
}

export function debounce (func, delay) {
  var timer
  return function (...args) {
    if (timer) {
      clearTimeout(timer)
    }
    timer = setTimeout(() => {
      func.apply(this, args)
    }, delay)
  }
}
